package com.wyl.servlet

import com.wyl.utils.USER_SESSION
import javax.servlet.annotation.WebServlet
import javax.servlet.http.HttpServlet
import javax.servlet.http.HttpServletRequest
import javax.servlet.http.HttpServletResponse

@WebServlet("/jsp/logout.do")
class LogoutServlet : HttpServlet() {
    override fun doGet(req: HttpServletRequest, resp: HttpServletResponse) {
        req.session.removeAttribute(USER_SESSION)
        resp.sendRedirect(req.contextPath + "/login.jsp")
    }

    override fun doPost(req: HttpServletRequest, resp: HttpServletResponse) {
        this.doGet(req, resp)
    }
}